Scripting languages offer simplicity and ease of development to software developers. Script code is easy to write since scripting languages are often based on a small set of expressions and statements that are simple to learn. Software developers often use scripting languages for rapid development of applications, for example, web applications. Scripting languages may be used for server side programs or for client side programs. Examples of server side scripting languages include PHP (Personal Home Page) and examples of client side scripting languages include JAVASCRIPT.
Server side script code can be used for executing a user request received at a web server by dynamically generating web pages. Server side scripting is often used for implementation of interactive websites that interface with data stores for retrieving and storing information. The PHP scripting language allows embedding of script code with hypertext markup language (HTML). Client side script code is often used for performing simple computations on the client side rather than sending a request to the server for simple computations.
Conventional approaches to execute script code include executing the script code using an interpreter. However, an interpreter may not be able to perform several optimizations that a compiler that generates executable code can perform. Therefore, interpreting script code can be inefficient compared to running executable code obtained by compiling the script code. Most compilers translate the source program first to some form of intermediate representation (IR) and convert from there into machine code. The IR is independent of the machine for which the IR is generated, and independent of the source code language it is generated from.
There are many IRs in use but these various representations do not provide efficient means for tracking references an object allocated in the memory. When an object is created and allocated space in the memory, many variables can refer to the same object, that is, the object may have various pointers pointing to the object. The current IRs do not provide an efficient way to track the number of references to the object. The operations for tracking the references, such as incrementing a count when a new pointer is pointing to the object and decrementing a count when the pointer is removed, are built into or inherent to the operations that create, delete, assign objects. The current IRs do not provide an opportunity to optimize the reference count operations. Accordingly, an executable code generated from the IR includes significant amount of code for tracking the references, which consumes significant computing resources.